package com.meixiang.entity.shopping;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 商品规格标签
 *
 * @author LZRUI
 */
public class SpecTagEntity implements Parcelable {

    private String spId; // 规格类型
    private String spName; // 规格类型名称 如款式
    private List<SpecTagValueEntity> specValueList; // 规格值列表

    public SpecTagEntity(String spId, String spName, List<SpecTagValueEntity> specValueList) {
        this.spId = spId;
        this.spName = spName;
        this.specValueList = specValueList;
    }

    public SpecTagEntity() {
    }

    public String getSpId() {
        return spId == null ? "" : spId;
    }

    public void setSpId(String spId) {
        this.spId = spId;
    }

    public String getSpName() {
        return spName == null ? "" : spName;
    }

    public void setSpName(String spName) {
        this.spName = spName;
    }

    public List<SpecTagValueEntity> getSpecValueList() {
        return specValueList;
    }

    public void setSpecValueList(List<SpecTagValueEntity> specValueList) {
        this.specValueList = specValueList;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.spId);
        dest.writeString(this.spName);
        dest.writeTypedList(this.specValueList);
    }

    protected SpecTagEntity(Parcel in) {
        this.spId = in.readString();
        this.spName = in.readString();
        this.specValueList = in.createTypedArrayList(SpecTagValueEntity.CREATOR);
    }

    public static final Creator<SpecTagEntity> CREATOR = new Creator<SpecTagEntity>() {
        @Override
        public SpecTagEntity createFromParcel(Parcel source) {
            return new SpecTagEntity(source);
        }

        @Override
        public SpecTagEntity[] newArray(int size) {
            return new SpecTagEntity[size];
        }
    };
}
